﻿//09.In the combinatorial mathematics, the Catalan numbers are calculated by the following formula:
//Write a program to calculate the Nth Catalan number by given N.

using System;


namespace CatalanNumbers
{
    class CatalanNumbers
    {
        static void Main()
        {
            Console.Write("Enter n = ");
            int n = int.Parse(Console.ReadLine());

            decimal product = 1;
            int midProduct = 1;

            for (int i = 2 * n; i > (n + 1); i--)
            {
                midProduct *= i;
            }
            product *= midProduct;

            for (int i = 1; i <= n; i++)
            {
                product /= i;
            }

            Console.WriteLine("(2n)! / (n + 1)! * n! = {0}", product);
        }
    }
}
